/* Copyright (C) 2005,2006,2008 G.P. Halkes
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 3, as
   published by the Free Software Foundation.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef IO_H
#define IO_H

#include "nonRuleAnalysis.h"
#include "bool.h"
#define IDENTIFIER_STRING "/* THIS FILE IS GNU GPL FREE SOFTWARE VERSION 3+ HAS BEEN AUTOMATICALLY GENERATED BY LLnextgen. DO NOT EDIT */\n"

typedef struct {
	const char *name;
	bool traceLines;
	int line;
	FILE *stream;
} File;

File *checkAndOpenFile(const char *name, bool generateLineDirectives);
#ifdef __GNUC__
int tfprintf(File *, const char *format, ...) __attribute__((format (printf, 2, 3)));
#else
int tfprintf(File *, const char *format, ...);
#endif
int tfputsn(File *file, const char *string, size_t n);
int tfputs(File *file, const char *string);
int tfputc(File *file, int c);
int tfprintDirective(File *file, CCode *code);
int tfprintTokenComment(File *file, int token);

void closeFile(File *file, bool freeName);
#endif

